Skip to content

feat: add POST /api/sandbox endpoint#155

Merged
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4023-api-create-sandbox-post-sandbox
Jan 23, 2026
Merged

feat: add POST /api/sandbox endpoint#155
sweetmantech merged 5 commits intotestfrom
sweetmantech/myc-4023-api-create-sandbox-post-sandbox

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

Summary

  • Add POST /api/sandbox endpoint to create ephemeral sandbox environments
  • Integrate @vercel/sandbox SDK for sandbox creation
  • Return sandboxId, status, timeout, and createdAt in response

Files Added

  • app/api/sandbox/route.ts - Route handler with CORS and JSDoc
  • lib/sandbox/createSandbox.ts - Sandbox creation logic using Vercel SDK
  • lib/sandbox/createSandboxPostHandler.ts - Request handler with API key auth

Test plan

  • Verify API key authentication works
  • Test sandbox creation returns expected response shape
  • Confirm CORS headers are set correctly

🤖 Generated with Claude Code

sidneyswift and others added 3 commits January 23, 2026 12:44
* feat: add Google Drive and Google Docs to enabled toolkits

- Add googledrive and googledocs to ENABLED_TOOLKITS array
- Enables Tool Router access to Google Drive and Google Docs tools

* docs: update JSDoc to mention all Google integrations
Create ephemeral sandbox environments using Vercel Sandbox SDK.
- Add route handler with CORS and API key authentication
- Add createSandbox function using @vercel/sandbox
- Returns sandboxId, status, timeout, createdAt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
recoup-api Ready Ready Preview Jan 23, 2026 7:57pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 23, 2026

Braintrust eval report

Catalog Opportunity Analysis Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Catalog_availability 44% (+28.999999999999996pp) 3 🟢 1 🔴
Llm_calls 0 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 33.84s (-1.73s) 3 🟢 2 🔴

Catalog Songs Count Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
AnswerCorrectness 19.1% (0pp) 1 🟢 2 🔴
Factuality 33.3% (-67pp) - 2 🔴
Llm_calls 4 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 12.01s (-3.25s) 3 🟢 -

First Week Album Sales Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Factuality 50% (-5pp) - 1 🔴
Llm_calls 1 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 13.72s (-1.9s) 3 🟢 1 🔴

Memory & Storage Tools Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Tools_called 0% (+0pp) - -
Llm_calls 0 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 15.1s (-1.2s) 1 🟢 -

Monthly Listeners Tracking Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
AnswerSimilarity 78.2% (+3pp) 4 🟢 1 🔴
Llm_calls 2 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 12.08s (-0.18s) 4 🟢 1 🔴

Search Web Tool Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
AnswerCorrectness 28% (+1pp) 6 🟢 5 🔴
Llm_calls 3 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 23.42s (-0.95s) 3 🟢 8 🔴

Social Scraping Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Tools_called 0% (+0pp) - -
Llm_calls 0 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 20.54s (-2.16s) 4 🟢 2 🔴

Spotify Followers Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
AnswerCorrectness 20.5% (0pp) 1 🟢 4 🔴
Llm_calls 3 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 11.2s (-1.71s) 3 🟢 2 🔴

Spotify Tools Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Tools_called 0% (+0pp) - -
Llm_calls 0 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 33.27s (+7.36s) - 2 🔴

TikTok Analytics Questions Evaluation (HEAD-1769198199)

Score Average Improvements Regressions
Question_answered 0% (+0pp) - -
Llm_calls 0 (+0) - -
Tool_calls 0 (+0) - -
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 0tok (+0tok) - -
Prompt_cached_tokens 0tok (+0tok) - -
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 0tok (+0tok) - -
Completion_reasoning_tokens 0tok (+0tok) - -
Total_tokens 0tok (+0tok) - -
Duration 19.95s (+4.8s) - 2 🔴

The Vercel Sandbox SDK includes "snapshotting" as a valid status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment on lines +12 to +19
* @param request - The request object
* @returns A NextResponse with sandbox data or error
*/
export async function createSandboxPostHandler(request: NextRequest): Promise<NextResponse> {
const accountIdOrError = await getApiKeyAccountId(request);
if (accountIdOrError instanceof NextResponse) {
return accountIdOrError;
}
Copy link
Copy Markdown
Contributor

@vercel vercel bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handler extracts accountId for authentication but never uses it, making the purpose of the validation unclear and suggesting incomplete implementation

Fix on Vercel

try {
const sandbox = await createSandbox();

return NextResponse.json(sandbox, { status: 200, headers: getCorsHeaders() });
Copy link
Copy Markdown
Contributor

@vercel vercel bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sandbox POST endpoint returns raw object instead of wrapped object, inconsistent with workspace and artist endpoints

Fix on Vercel

return NextResponse.json(sandbox, { status: 200, headers: getCorsHeaders() });
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to create sandbox";
return NextResponse.json({ error: message }, { status: 400, headers: getCorsHeaders() });
Copy link
Copy Markdown
Contributor

@vercel vercel bot Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sandbox error handler returns { error: message } instead of { status: "error", error: message }, inconsistent with workspace and other handlers

Fix on Vercel

DRY - reference types from @vercel/sandbox instead of duplicating.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit 7b3af1d into test Jan 23, 2026
5 checks passed
@sweetmantech sweetmantech deleted the sweetmantech/myc-4023-api-create-sandbox-post-sandbox branch January 23, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants